package com.spring.aop.cglibproxy;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class MyIntercepter implements MethodInterceptor {
    public Object intercept(Object o, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("汽车经销商：性价比很高！");
        Object result = methodProxy.invokeSuper(o, args);   //这行和jdkProxy不一样
        System.out.println("汽车经销商：赚差价！");
        return result;
    }
}
